﻿<Page x:Class="Probel.Ldoc.Views.Pages.IncoherencesView"
      
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:t="clr-namespace:Probel.Ldoc.Views.Properties"
      xmlns:ctrl="clr-namespace:Probel.Ldoc.Views.Controls"
      xmlns:conv="clr-namespace:Probel.Ldoc.Views.Converters"
      
      mc:Ignorable="d" 
      d:DesignHeight="768" 
      d:DesignWidth="1024"
      
      Background="{x:Null}">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Themes/Generic.xaml"/>
                <ResourceDictionary>
                    <conv:IncoherenceLvlToImageConverter x:Key="EnumToImage"/>
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Page.Resources>
    <HeaderedContentControl Header="{x:Static t:Messages.Header_Incoherences}">
        <DockPanel LastChildFill="True">
            <DataGrid DockPanel.Dock="Bottom"
                          Height="200"
                          ItemsSource="{Binding Result}"
                          AutoGenerateColumns="False"
                          CanUserAddRows="False"
                          CanUserDeleteRows="False"
                          GridLinesVisibility="None" SelectionChanged="DataGrid_SelectionChanged">
                <DataGrid.Columns>
                    <DataGridTemplateColumn Width="30"
                                            IsReadOnly="True">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Image Source="{Binding Path=Level, Converter={StaticResource EnumToImage}}"
                                       Height="16"
                                       Width="16"/>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTextColumn Binding="{Binding Message}"                                         
                                        Header="{x:Static t:Messages.DgHeader_Message}"
                                        Width="*"
                                        IsReadOnly="True" />
                </DataGrid.Columns>
            </DataGrid>
            <Border DockPanel.Dock="Top"
                        Height="Auto">
                <ToolBar Height="27" 
                             ToolBarTray.IsLocked="True">
                    <Button ToolTip="{x:Static t:Messages.Btn_AnalyseDatabase}"
                                Command="{Binding AnalyseCommand}">
                        <Image Source="/Probel.Ldoc.Views;component/Images/Build.png"/>
                    </Button>
                    <Button ToolTip="{x:Static t:Messages.Btn_Fix}"
                                Command="{Binding FixCommand}">
                        <Image Source="/Probel.Ldoc.Views;component/Images/Execute.png"/>
                    </Button>
                </ToolBar>
            </Border>
            <Frame x:Name="frame"/>
        </DockPanel>
    </HeaderedContentControl>
</Page>
